<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Types.Name.Shape</span><span>
</span><span id="line-4"></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#NameShape"><span class="hs-identifier">NameShape</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-5"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html#emptyNameShape"><span class="hs-identifier">emptyNameShape</span></a></span><span>
</span><span id="line-6"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html#mkNameShape"><span class="hs-identifier">mkNameShape</span></a></span><span>
</span><span id="line-7"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html#extendNameShape"><span class="hs-identifier">extendNameShape</span></a></span><span>
</span><span id="line-8"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html#nameShapeExports"><span class="hs-identifier">nameShapeExports</span></a></span><span>
</span><span id="line-9"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html#substNameShape"><span class="hs-identifier">substNameShape</span></a></span><span>
</span><span id="line-10"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html#maybeSubstNameShape"><span class="hs-identifier">maybeSubstNameShape</span></a></span><span>
</span><span id="line-11"></span><span>   </span><span class="hs-special">)</span><span>
</span><span id="line-12"></span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-16"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-17"></span><span>
</span><span id="line-18"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-19"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html"><span class="hs-identifier">GHC.Driver.Types</span></a></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html"><span class="hs-identifier">GHC.Types.Unique.FM</span></a></span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Avail.html"><span class="hs-identifier">GHC.Types.Avail</span></a></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.FieldLabel.html"><span class="hs-identifier">GHC.Types.FieldLabel</span></a></span><span>
</span><span id="line-24"></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html"><span class="hs-identifier">GHC.Types.Name.Env</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html"><span class="hs-identifier">GHC.Tc.Utils.Monad</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Iface.Env.html"><span class="hs-identifier">GHC.Iface.Env</span></a></span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-32"></span><span>
</span><span id="line-33"></span><span class="hs-comment">-- Note [NameShape]</span><span>
</span><span id="line-34"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-35"></span><span class="hs-comment">-- When we write a declaration in a signature, e.g., data T, we</span><span>
</span><span id="line-36"></span><span class="hs-comment">-- ascribe to it a *name variable*, e.g., {m.T}.  This</span><span>
</span><span id="line-37"></span><span class="hs-comment">-- name variable may be substituted with an actual original</span><span>
</span><span id="line-38"></span><span class="hs-comment">-- name when the signature is implemented (or even if we</span><span>
</span><span id="line-39"></span><span class="hs-comment">-- merge the signature with one which reexports this entity</span><span>
</span><span id="line-40"></span><span class="hs-comment">-- from another module).</span><span>
</span><span id="line-41"></span><span>
</span><span id="line-42"></span><span class="hs-comment">-- When we instantiate a signature m with a module M,</span><span>
</span><span id="line-43"></span><span class="hs-comment">-- we also need to substitute over names.  To do so, we must</span><span>
</span><span id="line-44"></span><span class="hs-comment">-- compute the *name substitution* induced by the *exports*</span><span>
</span><span id="line-45"></span><span class="hs-comment">-- of the module in question.  A NameShape represents</span><span>
</span><span id="line-46"></span><span class="hs-comment">-- such a name substitution for a single module instantiation.</span><span>
</span><span id="line-47"></span><span class="hs-comment">-- The &quot;shape&quot; in the name comes from the fact that the computation</span><span>
</span><span id="line-48"></span><span class="hs-comment">-- of a name substitution is essentially the *shaping pass* from</span><span>
</span><span id="line-49"></span><span class="hs-comment">-- Backpack'14, but in a far more restricted form.</span><span>
</span><span id="line-50"></span><span>
</span><span id="line-51"></span><span class="hs-comment">-- The name substitution for an export list is easy to explain.  If we are</span><span>
</span><span id="line-52"></span><span class="hs-comment">-- filling the module variable &lt;m&gt;, given an export N of the form</span><span>
</span><span id="line-53"></span><span class="hs-comment">-- M.n or {m'.n} (where n is an OccName), the induced name</span><span>
</span><span id="line-54"></span><span class="hs-comment">-- substitution is from {m.n} to N.  So, for example, if we have</span><span>
</span><span id="line-55"></span><span class="hs-comment">-- A=impl:B, and the exports of impl:B are impl:B.f and</span><span>
</span><span id="line-56"></span><span class="hs-comment">-- impl:C.g, then our name substitution is {A.f} to impl:B.f</span><span>
</span><span id="line-57"></span><span class="hs-comment">-- and {A.g} to impl:C.g</span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span>
</span><span id="line-60"></span><span>
</span><span id="line-61"></span><span>
</span><span id="line-62"></span><span class="hs-comment">-- The 'NameShape' type is defined in GHC.Tc.Types, because GHC.Tc.Types</span><span>
</span><span id="line-63"></span><span class="hs-comment">-- needs to refer to NameShape, and having GHC.Tc.Types import</span><span>
</span><span id="line-64"></span><span class="hs-comment">-- NameShape (even by SOURCE) would cause a large number of</span><span>
</span><span id="line-65"></span><span class="hs-comment">-- modules to be pulled into the DynFlags cycle.</span><span>
</span><span id="line-66"></span><span class="hs-comment">{-
data NameShape = NameShape {
        ns_mod_name :: ModuleName,
        ns_exports :: [AvailInfo],
        ns_map :: OccEnv Name
    }
-}</span><span>
</span><span id="line-73"></span><span>
</span><span id="line-74"></span><span class="hs-comment">-- NB: substitution functions need 'HscEnv' since they need the name cache</span><span>
</span><span id="line-75"></span><span class="hs-comment">-- to allocate new names if we change the 'Module' of a 'Name'</span><span>
</span><span id="line-76"></span><span>
</span><span id="line-77"></span><span class="hs-comment">-- | Create an empty 'NameShape' (i.e., the renaming that</span><span>
</span><span id="line-78"></span><span class="hs-comment">-- would occur with an implementing module with no exports)</span><span>
</span><span id="line-79"></span><span class="hs-comment">-- for a specific hole @mod_name@.</span><span>
</span><span id="line-80"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#emptyNameShape"><span class="hs-identifier hs-type">emptyNameShape</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#NameShape"><span class="hs-identifier hs-type">NameShape</span></a></span><span>
</span><span id="line-81"></span><span id="emptyNameShape"><span class="annot"><span class="annottext">emptyNameShape :: ModuleName -&gt; NameShape
</span><a href="GHC.Types.Name.Shape.html#emptyNameShape"><span class="hs-identifier hs-var hs-var">emptyNameShape</span></a></span></span><span> </span><span id="local-6989586621681090306"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090306"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; [AvailInfo] -&gt; OccEnv Name -&gt; NameShape
</span><a href="GHC.Tc.Types.html#NameShape"><span class="hs-identifier hs-var">NameShape</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090306"><span class="hs-identifier hs-var">mod_name</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">OccEnv Name
forall a. OccEnv a
</span><a href="GHC.Types.Name.Occurrence.html#emptyOccEnv"><span class="hs-identifier hs-var">emptyOccEnv</span></a></span><span>
</span><span id="line-82"></span><span>
</span><span id="line-83"></span><span class="hs-comment">-- | Create a 'NameShape' corresponding to an implementing</span><span>
</span><span id="line-84"></span><span class="hs-comment">-- module for the hole @mod_name@ that exports a list of 'AvailInfo's.</span><span>
</span><span id="line-85"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#mkNameShape"><span class="hs-identifier hs-type">mkNameShape</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#NameShape"><span class="hs-identifier hs-type">NameShape</span></a></span><span>
</span><span id="line-86"></span><span id="mkNameShape"><span class="annot"><span class="annottext">mkNameShape :: ModuleName -&gt; [AvailInfo] -&gt; NameShape
</span><a href="GHC.Types.Name.Shape.html#mkNameShape"><span class="hs-identifier hs-var hs-var">mkNameShape</span></a></span></span><span> </span><span id="local-6989586621681090303"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090303"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span> </span><span id="local-6989586621681090302"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090302"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-87"></span><span>    </span><span class="annot"><span class="annottext">ModuleName -&gt; [AvailInfo] -&gt; OccEnv Name -&gt; NameShape
</span><a href="GHC.Tc.Types.html#NameShape"><span class="hs-identifier hs-var">NameShape</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090303"><span class="hs-identifier hs-var">mod_name</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090302"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">(OccEnv Name -&gt; NameShape) -&gt; OccEnv Name -&gt; NameShape
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[(OccName, Name)] -&gt; OccEnv Name
forall a. [(OccName, a)] -&gt; OccEnv a
</span><a href="GHC.Types.Name.Occurrence.html#mkOccEnv"><span class="hs-identifier hs-var">mkOccEnv</span></a></span><span> </span><span class="annot"><span class="annottext">([(OccName, Name)] -&gt; OccEnv Name)
-&gt; [(OccName, Name)] -&gt; OccEnv Name
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-88"></span><span>        </span><span id="local-6989586621681090300"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090300"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090302"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-89"></span><span>        </span><span id="local-6989586621681090299"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090299"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; Name
</span><a href="GHC.Types.Avail.html#availName"><span class="hs-identifier hs-var">availName</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090300"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; [Name] -&gt; [Name]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; [Name]
</span><a href="GHC.Types.Avail.html#availNamesWithSelectors"><span class="hs-identifier hs-var">availNamesWithSelectors</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090300"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-90"></span><span>        </span><span class="annot"><span class="annottext">(OccName, Name) -&gt; [(OccName, Name)]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; OccName
forall name. HasOccName name =&gt; name -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090299"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090299"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-91"></span><span>
</span><span id="line-92"></span><span class="hs-comment">-- | Given an existing 'NameShape', merge it with a list of 'AvailInfo's</span><span>
</span><span id="line-93"></span><span class="hs-comment">-- with Backpack style mix-in linking.  This is used solely when merging</span><span>
</span><span id="line-94"></span><span class="hs-comment">-- signatures together: we successively merge the exports of each</span><span>
</span><span id="line-95"></span><span class="hs-comment">-- signature until we have the final, full exports of the merged signature.</span><span>
</span><span id="line-96"></span><span class="hs-comment">--</span><span>
</span><span id="line-97"></span><span class="hs-comment">-- What makes this operation nontrivial is what we are supposed to do when</span><span>
</span><span id="line-98"></span><span class="hs-comment">-- we want to merge in an export for M.T when we already have an existing</span><span>
</span><span id="line-99"></span><span class="hs-comment">-- export {H.T}.  What should happen in this case is that {H.T} should be</span><span>
</span><span id="line-100"></span><span class="hs-comment">-- unified with @M.T@: we've determined a more *precise* identity for the</span><span>
</span><span id="line-101"></span><span class="hs-comment">-- export at 'OccName' @T@.</span><span>
</span><span id="line-102"></span><span class="hs-comment">--</span><span>
</span><span id="line-103"></span><span class="hs-comment">-- Note that we don't do unrestricted unification: only name holes from</span><span>
</span><span id="line-104"></span><span class="hs-comment">-- @ns_mod_name ns@ are flexible.  This is because we have a much more</span><span>
</span><span id="line-105"></span><span class="hs-comment">-- restricted notion of shaping than in Backpack'14: we do shaping</span><span>
</span><span id="line-106"></span><span class="hs-comment">-- *as* we do type-checking.  Thus, once we shape a signature, its</span><span>
</span><span id="line-107"></span><span class="hs-comment">-- exports are *final* and we're not allowed to refine them further,</span><span>
</span><span id="line-108"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#extendNameShape"><span class="hs-identifier hs-type">extendNameShape</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#NameShape"><span class="hs-identifier hs-type">NameShape</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#NameShape"><span class="hs-identifier hs-type">NameShape</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-109"></span><span id="extendNameShape"><span class="annot"><span class="annottext">extendNameShape :: HscEnv -&gt; NameShape -&gt; [AvailInfo] -&gt; IO (Either SDoc NameShape)
</span><a href="GHC.Types.Name.Shape.html#extendNameShape"><span class="hs-identifier hs-var hs-var">extendNameShape</span></a></span></span><span> </span><span id="local-6989586621681090295"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681090295"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681090294"><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681090294"><span class="hs-identifier hs-var">ns</span></a></span></span><span> </span><span id="local-6989586621681090293"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090293"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-110"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; [AvailInfo] -&gt; [AvailInfo] -&gt; Either SDoc ShNameSubst
</span><a href="GHC.Types.Name.Shape.html#uAvailInfos"><span class="hs-identifier hs-var">uAvailInfos</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NameShape -&gt; ModuleName
</span><a href="GHC.Tc.Types.html#ns_mod_name"><span class="hs-identifier hs-var hs-var">ns_mod_name</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681090294"><span class="hs-identifier hs-var">ns</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NameShape -&gt; [AvailInfo]
</span><a href="GHC.Tc.Types.html#ns_exports"><span class="hs-identifier hs-var hs-var">ns_exports</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681090294"><span class="hs-identifier hs-var">ns</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090293"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-111"></span><span>        </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span id="local-6989586621681090289"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681090289"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Either SDoc NameShape -&gt; IO (Either SDoc NameShape)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; Either SDoc NameShape
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681090289"><span class="hs-identifier hs-var">err</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-112"></span><span>        </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621681090288"><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090288"><span class="hs-identifier hs-var">nsubst</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-113"></span><span>            </span><span id="local-6989586621681090287"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090287"><span class="hs-identifier hs-var">as1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(AvailInfo -&gt; IO AvailInfo) -&gt; [AvailInfo] -&gt; IO [AvailInfo]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IO AvailInfo -&gt; IO AvailInfo
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO AvailInfo -&gt; IO AvailInfo)
-&gt; (AvailInfo -&gt; IO AvailInfo) -&gt; AvailInfo -&gt; IO AvailInfo
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; ShNameSubst -&gt; AvailInfo -&gt; IO AvailInfo
</span><a href="GHC.Types.Name.Shape.html#substNameAvailInfo"><span class="hs-identifier hs-var">substNameAvailInfo</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681090295"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090288"><span class="hs-identifier hs-var">nsubst</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NameShape -&gt; [AvailInfo]
</span><a href="GHC.Tc.Types.html#ns_exports"><span class="hs-identifier hs-var hs-var">ns_exports</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681090294"><span class="hs-identifier hs-var">ns</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-114"></span><span>            </span><span id="local-6989586621681090282"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090282"><span class="hs-identifier hs-var">as2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(AvailInfo -&gt; IO AvailInfo) -&gt; [AvailInfo] -&gt; IO [AvailInfo]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IO AvailInfo -&gt; IO AvailInfo
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO AvailInfo -&gt; IO AvailInfo)
-&gt; (AvailInfo -&gt; IO AvailInfo) -&gt; AvailInfo -&gt; IO AvailInfo
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; ShNameSubst -&gt; AvailInfo -&gt; IO AvailInfo
</span><a href="GHC.Types.Name.Shape.html#substNameAvailInfo"><span class="hs-identifier hs-var">substNameAvailInfo</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681090295"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090288"><span class="hs-identifier hs-var">nsubst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090293"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-115"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681090281"><span class="annot"><span class="annottext">new_avails :: [AvailInfo]
</span><a href="#local-6989586621681090281"><span class="hs-identifier hs-var hs-var">new_avails</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[AvailInfo] -&gt; [AvailInfo] -&gt; [AvailInfo]
</span><a href="GHC.Types.Name.Shape.html#mergeAvails"><span class="hs-identifier hs-var">mergeAvails</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090287"><span class="hs-identifier hs-var">as1</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090282"><span class="hs-identifier hs-var">as2</span></a></span><span>
</span><span id="line-116"></span><span>            </span><span class="annot"><span class="annottext">Either SDoc NameShape -&gt; IO (Either SDoc NameShape)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Either SDoc NameShape -&gt; IO (Either SDoc NameShape))
-&gt; (NameShape -&gt; Either SDoc NameShape)
-&gt; NameShape
-&gt; IO (Either SDoc NameShape)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape -&gt; Either SDoc NameShape
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="annot"><span class="annottext">(NameShape -&gt; IO (Either SDoc NameShape))
-&gt; NameShape -&gt; IO (Either SDoc NameShape)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681090294"><span class="hs-identifier hs-var">ns</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-117"></span><span>                </span><span class="annot"><span class="annottext">ns_exports :: [AvailInfo]
</span><a href="GHC.Tc.Types.html#ns_exports"><span class="hs-identifier hs-var">ns_exports</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090281"><span class="hs-identifier hs-var">new_avails</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-118"></span><span>                </span><span class="hs-comment">-- TODO: stop repeatedly rebuilding the OccEnv</span><span>
</span><span id="line-119"></span><span>                </span><span class="annot"><span class="annottext">ns_map :: OccEnv Name
</span><a href="GHC.Tc.Types.html#ns_map"><span class="hs-identifier hs-var">ns_map</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(OccName, Name)] -&gt; OccEnv Name
forall a. [(OccName, a)] -&gt; OccEnv a
</span><a href="GHC.Types.Name.Occurrence.html#mkOccEnv"><span class="hs-identifier hs-var">mkOccEnv</span></a></span><span> </span><span class="annot"><span class="annottext">([(OccName, Name)] -&gt; OccEnv Name)
-&gt; [(OccName, Name)] -&gt; OccEnv Name
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-120"></span><span>                            </span><span id="local-6989586621681090278"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090278"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090281"><span class="hs-identifier hs-var">new_avails</span></a></span><span>
</span><span id="line-121"></span><span>                            </span><span id="local-6989586621681090277"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090277"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; Name
</span><a href="GHC.Types.Avail.html#availName"><span class="hs-identifier hs-var">availName</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090278"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; [Name] -&gt; [Name]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; [Name]
</span><a href="GHC.Types.Avail.html#availNames"><span class="hs-identifier hs-var">availNames</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090278"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-122"></span><span>                            </span><span class="annot"><span class="annottext">(OccName, Name) -&gt; [(OccName, Name)]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; OccName
forall name. HasOccName name =&gt; name -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090277"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090277"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-123"></span><span>                </span><span class="hs-special">}</span><span>
</span><span id="line-124"></span><span>
</span><span id="line-125"></span><span class="hs-comment">-- | The export list associated with this 'NameShape' (i.e., what</span><span>
</span><span id="line-126"></span><span class="hs-comment">-- the exports of an implementing module which induces this 'NameShape'</span><span>
</span><span id="line-127"></span><span class="hs-comment">-- would be.)</span><span>
</span><span id="line-128"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#nameShapeExports"><span class="hs-identifier hs-type">nameShapeExports</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#NameShape"><span class="hs-identifier hs-type">NameShape</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-129"></span><span id="nameShapeExports"><span class="annot"><span class="annottext">nameShapeExports :: NameShape -&gt; [AvailInfo]
</span><a href="GHC.Types.Name.Shape.html#nameShapeExports"><span class="hs-identifier hs-var hs-var">nameShapeExports</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameShape -&gt; [AvailInfo]
</span><a href="GHC.Tc.Types.html#ns_exports"><span class="hs-identifier hs-var hs-var">ns_exports</span></a></span><span>
</span><span id="line-130"></span><span>
</span><span id="line-131"></span><span class="hs-comment">-- | Given a 'Name', substitute it according to the 'NameShape' implied</span><span>
</span><span id="line-132"></span><span class="hs-comment">-- substitution, i.e. map @{A.T}@ to @M.T@, if the implementing module</span><span>
</span><span id="line-133"></span><span class="hs-comment">-- exports @M.T@.</span><span>
</span><span id="line-134"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#substNameShape"><span class="hs-identifier hs-type">substNameShape</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#NameShape"><span class="hs-identifier hs-type">NameShape</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>
</span><span id="line-135"></span><span id="substNameShape"><span class="annot"><span class="annottext">substNameShape :: NameShape -&gt; Name -&gt; Name
</span><a href="GHC.Types.Name.Shape.html#substNameShape"><span class="hs-identifier hs-var hs-var">substNameShape</span></a></span></span><span> </span><span id="local-6989586621681090275"><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681090275"><span class="hs-identifier hs-var">ns</span></a></span></span><span> </span><span id="local-6989586621681090274"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090274"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; Module
Name -&gt; Module
</span><a href="GHC.Types.Name.html#nameModule"><span class="hs-identifier hs-var">nameModule</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090274"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; Module -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">NameShape -&gt; Module
</span><a href="GHC.Types.Name.Shape.html#ns_module"><span class="hs-identifier hs-var">ns_module</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681090275"><span class="hs-identifier hs-var">ns</span></a></span><span>
</span><span id="line-136"></span><span>                    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681090271"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090271"><span class="hs-identifier hs-var">n'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">OccEnv Name -&gt; OccName -&gt; Maybe Name
forall a. OccEnv a -&gt; OccName -&gt; Maybe a
</span><a href="GHC.Types.Name.Occurrence.html#lookupOccEnv"><span class="hs-identifier hs-var">lookupOccEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NameShape -&gt; OccEnv Name
</span><a href="GHC.Tc.Types.html#ns_map"><span class="hs-identifier hs-var hs-var">ns_map</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681090275"><span class="hs-identifier hs-var">ns</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; OccName
forall name. HasOccName name =&gt; name -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090274"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-137"></span><span>                    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090271"><span class="hs-identifier hs-var">n'</span></a></span><span>
</span><span id="line-138"></span><span>                    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-139"></span><span>                    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090274"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-140"></span><span>
</span><span id="line-141"></span><span class="hs-comment">-- | Like 'substNameShape', but returns @Nothing@ if no substitution</span><span>
</span><span id="line-142"></span><span class="hs-comment">-- works.</span><span>
</span><span id="line-143"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#maybeSubstNameShape"><span class="hs-identifier hs-type">maybeSubstNameShape</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#NameShape"><span class="hs-identifier hs-type">NameShape</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>
</span><span id="line-144"></span><span id="maybeSubstNameShape"><span class="annot"><span class="annottext">maybeSubstNameShape :: NameShape -&gt; Name -&gt; Maybe Name
</span><a href="GHC.Types.Name.Shape.html#maybeSubstNameShape"><span class="hs-identifier hs-var hs-var">maybeSubstNameShape</span></a></span></span><span> </span><span id="local-6989586621681090269"><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681090269"><span class="hs-identifier hs-var">ns</span></a></span></span><span> </span><span id="local-6989586621681090268"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090268"><span class="hs-identifier hs-var">n</span></a></span></span><span>
</span><span id="line-145"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; Module
Name -&gt; Module
</span><a href="GHC.Types.Name.html#nameModule"><span class="hs-identifier hs-var">nameModule</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090268"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; Module -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">NameShape -&gt; Module
</span><a href="GHC.Types.Name.Shape.html#ns_module"><span class="hs-identifier hs-var">ns_module</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681090269"><span class="hs-identifier hs-var">ns</span></a></span><span>
</span><span id="line-146"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccEnv Name -&gt; OccName -&gt; Maybe Name
forall a. OccEnv a -&gt; OccName -&gt; Maybe a
</span><a href="GHC.Types.Name.Occurrence.html#lookupOccEnv"><span class="hs-identifier hs-var">lookupOccEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NameShape -&gt; OccEnv Name
</span><a href="GHC.Tc.Types.html#ns_map"><span class="hs-identifier hs-var hs-var">ns_map</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape
</span><a href="#local-6989586621681090269"><span class="hs-identifier hs-var">ns</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; OccName
forall name. HasOccName name =&gt; name -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#occName"><span class="hs-identifier hs-var">occName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090268"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-147"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-148"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Name
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-149"></span><span>
</span><span id="line-150"></span><span class="hs-comment">-- | The 'Module' of any 'Name's a 'NameShape' has action over.</span><span>
</span><span id="line-151"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#ns_module"><span class="hs-identifier hs-type">ns_module</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#NameShape"><span class="hs-identifier hs-type">NameShape</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span>
</span><span id="line-152"></span><span id="ns_module"><span class="annot"><span class="annottext">ns_module :: NameShape -&gt; Module
</span><a href="GHC.Types.Name.Shape.html#ns_module"><span class="hs-identifier hs-var hs-var">ns_module</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; Module
forall u. ModuleName -&gt; GenModule (GenUnit u)
</span><a href="GHC.Unit.Module.html#mkHoleModule"><span class="hs-identifier hs-var">mkHoleModule</span></a></span><span> </span><span class="annot"><span class="annottext">(ModuleName -&gt; Module)
-&gt; (NameShape -&gt; ModuleName) -&gt; NameShape -&gt; Module
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">NameShape -&gt; ModuleName
</span><a href="GHC.Tc.Types.html#ns_mod_name"><span class="hs-identifier hs-var hs-var">ns_mod_name</span></a></span><span>
</span><span id="line-153"></span><span>
</span><span id="line-154"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                        Name substitutions
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-161"></span><span>
</span><span id="line-162"></span><span class="hs-comment">-- | Substitution on @{A.T}@.  We enforce the invariant that the</span><span>
</span><span id="line-163"></span><span class="hs-comment">-- 'nameModule' of keys of this map have 'moduleUnit' @hole@</span><span>
</span><span id="line-164"></span><span class="hs-comment">-- (meaning that if we have a hole substitution, the keys of the map</span><span>
</span><span id="line-165"></span><span class="hs-comment">-- are never affected.)  Alternatively, this is isomorphic to</span><span>
</span><span id="line-166"></span><span class="hs-comment">-- @Map ('ModuleName', 'OccName') 'Name'@.</span><span>
</span><span id="line-167"></span><span class="hs-keyword">type</span><span> </span><span id="ShNameSubst"><span class="annot"><a href="GHC.Types.Name.Shape.html#ShNameSubst"><span class="hs-identifier hs-var">ShNameSubst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html#NameEnv"><span class="hs-identifier hs-type">NameEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>
</span><span id="line-168"></span><span>
</span><span id="line-169"></span><span class="hs-comment">-- NB: In this module, we actually only ever construct 'ShNameSubst'</span><span>
</span><span id="line-170"></span><span class="hs-comment">-- at a single 'ModuleName'.  But 'ShNameSubst' is more convenient to</span><span>
</span><span id="line-171"></span><span class="hs-comment">-- work with.</span><span>
</span><span id="line-172"></span><span>
</span><span id="line-173"></span><span class="hs-comment">-- | Substitute names in a 'Name'.</span><span>
</span><span id="line-174"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#substName"><span class="hs-identifier hs-type">substName</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html#ShNameSubst"><span class="hs-identifier hs-type">ShNameSubst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>
</span><span id="line-175"></span><span id="substName"><span class="annot"><span class="annottext">substName :: ShNameSubst -&gt; Name -&gt; Name
</span><a href="GHC.Types.Name.Shape.html#substName"><span class="hs-identifier hs-var hs-var">substName</span></a></span></span><span> </span><span id="local-6989586621681090265"><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090265"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621681090264"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090264"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681090263"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090263"><span class="hs-identifier hs-var">n'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ShNameSubst -&gt; Name -&gt; Maybe Name
forall a. NameEnv a -&gt; Name -&gt; Maybe a
</span><a href="GHC.Types.Name.Env.html#lookupNameEnv"><span class="hs-identifier hs-var">lookupNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090265"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090264"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090263"><span class="hs-identifier hs-var">n'</span></a></span><span>
</span><span id="line-176"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090264"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-177"></span><span>
</span><span id="line-178"></span><span class="hs-comment">-- | Substitute names in an 'AvailInfo'.  This has special behavior</span><span>
</span><span id="line-179"></span><span class="hs-comment">-- for type constructors, where it is sufficient to substitute the 'availName'</span><span>
</span><span id="line-180"></span><span class="hs-comment">-- to induce a substitution on 'availNames'.</span><span>
</span><span id="line-181"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#substNameAvailInfo"><span class="hs-identifier hs-type">substNameAvailInfo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html#ShNameSubst"><span class="hs-identifier hs-type">ShNameSubst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span>
</span><span id="line-182"></span><span id="substNameAvailInfo"><span class="annot"><span class="annottext">substNameAvailInfo :: HscEnv -&gt; ShNameSubst -&gt; AvailInfo -&gt; IO AvailInfo
</span><a href="GHC.Types.Name.Shape.html#substNameAvailInfo"><span class="hs-identifier hs-var hs-var">substNameAvailInfo</span></a></span></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681090261"><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090261"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Avail.html#Avail"><span class="hs-identifier hs-type">Avail</span></a></span><span> </span><span id="local-6989586621681090259"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090259"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; IO AvailInfo
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; AvailInfo
</span><a href="GHC.Types.Avail.html#Avail"><span class="hs-identifier hs-var">Avail</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShNameSubst -&gt; Name -&gt; Name
</span><a href="GHC.Types.Name.Shape.html#substName"><span class="hs-identifier hs-var">substName</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090261"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090259"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-183"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#substNameAvailInfo"><span class="hs-identifier hs-var">substNameAvailInfo</span></a></span><span> </span><span id="local-6989586621681090258"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681090258"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681090257"><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090257"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-type">AvailTC</span></a></span><span> </span><span id="local-6989586621681090255"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090255"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621681090254"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681090254"><span class="hs-identifier hs-var">ns</span></a></span></span><span> </span><span id="local-6989586621681090253"><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681090253"><span class="hs-identifier hs-var">fs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-184"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681090249"><span class="annot"><span class="annottext">mb_mod :: Maybe Module
</span><a href="#local-6989586621681090249"><span class="hs-identifier hs-var hs-var">mb_mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Module) -&gt; Maybe Name -&gt; Maybe Module
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; Module
Name -&gt; Module
</span><a href="GHC.Types.Name.html#nameModule"><span class="hs-identifier hs-var">nameModule</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShNameSubst -&gt; Name -&gt; Maybe Name
forall a. NameEnv a -&gt; Name -&gt; Maybe a
</span><a href="GHC.Types.Name.Env.html#lookupNameEnv"><span class="hs-identifier hs-var">lookupNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090257"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090255"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-185"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Name -&gt; [Name] -&gt; [FieldLabel] -&gt; AvailInfo
</span><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-var">AvailTC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShNameSubst -&gt; Name -&gt; Name
</span><a href="GHC.Types.Name.Shape.html#substName"><span class="hs-identifier hs-var">substName</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090257"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090255"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-186"></span><span>        </span><span class="annot"><span class="annottext">([Name] -&gt; [FieldLabel] -&gt; AvailInfo)
-&gt; IO [Name] -&gt; IO ([FieldLabel] -&gt; AvailInfo)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(Name -&gt; IO Name) -&gt; [Name] -&gt; IO [Name]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; IfG Name -&gt; IO Name
forall a. HscEnv -&gt; IfG a -&gt; IO a
</span><a href="GHC.Tc.Utils.Monad.html#initIfaceLoad"><span class="hs-identifier hs-var">initIfaceLoad</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681090258"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">(IfG Name -&gt; IO Name) -&gt; (Name -&gt; IfG Name) -&gt; Name -&gt; IO Name
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Module -&gt; Name -&gt; IfG Name
forall m n. Maybe Module -&gt; Name -&gt; TcRnIf m n Name
</span><a href="GHC.Iface.Env.html#setNameModule"><span class="hs-identifier hs-var">setNameModule</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Module
</span><a href="#local-6989586621681090249"><span class="hs-identifier hs-var">mb_mod</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681090254"><span class="hs-identifier hs-var">ns</span></a></span><span>
</span><span id="line-187"></span><span>        </span><span class="annot"><span class="annottext">IO ([FieldLabel] -&gt; AvailInfo) -&gt; IO [FieldLabel] -&gt; IO AvailInfo
forall (f :: * -&gt; *) a b. Applicative f =&gt; f (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(FieldLabel -&gt; IO FieldLabel) -&gt; [FieldLabel] -&gt; IO [FieldLabel]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; Maybe Module -&gt; FieldLabel -&gt; IO FieldLabel
</span><a href="GHC.Types.Name.Shape.html#setNameFieldSelector"><span class="hs-identifier hs-var">setNameFieldSelector</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681090258"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Module
</span><a href="#local-6989586621681090249"><span class="hs-identifier hs-var">mb_mod</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681090253"><span class="hs-identifier hs-var">fs</span></a></span><span>
</span><span id="line-188"></span><span>
</span><span id="line-189"></span><span class="hs-comment">-- | Set the 'Module' of a 'FieldSelector'</span><span>
</span><span id="line-190"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#setNameFieldSelector"><span class="hs-identifier hs-type">setNameFieldSelector</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span>
</span><span id="line-191"></span><span id="setNameFieldSelector"><span class="annot"><span class="annottext">setNameFieldSelector :: HscEnv -&gt; Maybe Module -&gt; FieldLabel -&gt; IO FieldLabel
</span><a href="GHC.Types.Name.Shape.html#setNameFieldSelector"><span class="hs-identifier hs-var hs-var">setNameFieldSelector</span></a></span></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Maybe Module
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span id="local-6989586621681090244"><span class="annot"><span class="annottext">FieldLabel
</span><a href="#local-6989586621681090244"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FieldLabel -&gt; IO FieldLabel
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLabel
</span><a href="#local-6989586621681090244"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-192"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#setNameFieldSelector"><span class="hs-identifier hs-var">setNameFieldSelector</span></a></span><span> </span><span id="local-6989586621681090243"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681090243"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681090242"><span class="annot"><span class="annottext">Maybe Module
</span><a href="#local-6989586621681090242"><span class="hs-identifier hs-var">mb_mod</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span> </span><span id="local-6989586621681090240"><span class="annot"><span class="annottext">FieldLabelString
</span><a href="#local-6989586621681090240"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681090239"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681090239"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621681090238"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090238"><span class="hs-identifier hs-var">sel</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-193"></span><span>    </span><span id="local-6989586621681090237"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090237"><span class="hs-identifier hs-var">sel'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; IfG Name -&gt; IO Name
forall a. HscEnv -&gt; IfG a -&gt; IO a
</span><a href="GHC.Tc.Utils.Monad.html#initIfaceLoad"><span class="hs-identifier hs-var">initIfaceLoad</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681090243"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">(IfG Name -&gt; IO Name) -&gt; IfG Name -&gt; IO Name
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Module -&gt; Name -&gt; IfG Name
forall m n. Maybe Module -&gt; Name -&gt; TcRnIf m n Name
</span><a href="GHC.Iface.Env.html#setNameModule"><span class="hs-identifier hs-var">setNameModule</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Module
</span><a href="#local-6989586621681090242"><span class="hs-identifier hs-var">mb_mod</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090238"><span class="hs-identifier hs-var">sel</span></a></span><span>
</span><span id="line-194"></span><span>    </span><span class="annot"><span class="annottext">FieldLabel -&gt; IO FieldLabel
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FieldLabelString -&gt; Bool -&gt; Name -&gt; FieldLabel
forall a. FieldLabelString -&gt; Bool -&gt; a -&gt; FieldLbl a
</span><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-var">FieldLabel</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLabelString
</span><a href="#local-6989586621681090240"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681090239"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090237"><span class="hs-identifier hs-var">sel'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-195"></span><span>
</span><span id="line-196"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                        AvailInfo merging
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-203"></span><span>
</span><span id="line-204"></span><span class="hs-comment">-- | Merges to 'AvailInfo' lists together, assuming the 'AvailInfo's have</span><span>
</span><span id="line-205"></span><span class="hs-comment">-- already been unified ('uAvailInfos').</span><span>
</span><span id="line-206"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#mergeAvails"><span class="hs-identifier hs-type">mergeAvails</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-207"></span><span id="mergeAvails"><span class="annot"><span class="annottext">mergeAvails :: [AvailInfo] -&gt; [AvailInfo] -&gt; [AvailInfo]
</span><a href="GHC.Types.Name.Shape.html#mergeAvails"><span class="hs-identifier hs-var hs-var">mergeAvails</span></a></span></span><span> </span><span id="local-6989586621681090236"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090236"><span class="hs-identifier hs-var">as1</span></a></span></span><span> </span><span id="local-6989586621681090235"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090235"><span class="hs-identifier hs-var">as2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-208"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681090234"><span class="annot"><span class="annottext">mkNE :: [AvailInfo] -&gt; NameEnv AvailInfo
</span><a href="#local-6989586621681090234"><span class="hs-identifier hs-var hs-var">mkNE</span></a></span></span><span> </span><span id="local-6989586621681090233"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090233"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Name, AvailInfo)] -&gt; NameEnv AvailInfo
forall a. [(Name, a)] -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#mkNameEnv"><span class="hs-identifier hs-var">mkNameEnv</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">AvailInfo -&gt; Name
</span><a href="GHC.Types.Avail.html#availName"><span class="hs-identifier hs-var">availName</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090231"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090231"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681090231"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090231"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090233"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-209"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">NameEnv AvailInfo -&gt; [AvailInfo]
forall a. NameEnv a -&gt; [a]
</span><a href="GHC.Types.Name.Env.html#nameEnvElts"><span class="hs-identifier hs-var">nameEnvElts</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(AvailInfo -&gt; AvailInfo -&gt; AvailInfo)
-&gt; NameEnv AvailInfo -&gt; NameEnv AvailInfo -&gt; NameEnv AvailInfo
forall a. (a -&gt; a -&gt; a) -&gt; NameEnv a -&gt; NameEnv a -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#plusNameEnv_C"><span class="hs-identifier hs-var">plusNameEnv_C</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; AvailInfo -&gt; AvailInfo
</span><a href="GHC.Types.Avail.html#plusAvail"><span class="hs-identifier hs-var">plusAvail</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[AvailInfo] -&gt; NameEnv AvailInfo
</span><a href="#local-6989586621681090234"><span class="hs-identifier hs-var">mkNE</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090236"><span class="hs-identifier hs-var">as1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[AvailInfo] -&gt; NameEnv AvailInfo
</span><a href="#local-6989586621681090234"><span class="hs-identifier hs-var">mkNE</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090235"><span class="hs-identifier hs-var">as2</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-210"></span><span>
</span><span id="line-211"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
                        AvailInfo unification
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-218"></span><span>
</span><span id="line-219"></span><span class="hs-comment">-- | Unify two lists of 'AvailInfo's, given an existing substitution @subst@,</span><span>
</span><span id="line-220"></span><span class="hs-comment">-- with only name holes from @flexi@ unifiable (all other name holes rigid.)</span><span>
</span><span id="line-221"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#uAvailInfos"><span class="hs-identifier hs-type">uAvailInfos</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html#ShNameSubst"><span class="hs-identifier hs-type">ShNameSubst</span></a></span><span>
</span><span id="line-222"></span><span id="uAvailInfos"><span class="annot"><span class="annottext">uAvailInfos :: ModuleName -&gt; [AvailInfo] -&gt; [AvailInfo] -&gt; Either SDoc ShNameSubst
</span><a href="GHC.Types.Name.Shape.html#uAvailInfos"><span class="hs-identifier hs-var hs-var">uAvailInfos</span></a></span></span><span> </span><span id="local-6989586621681090227"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090227"><span class="hs-identifier hs-var">flexi</span></a></span></span><span> </span><span id="local-6989586621681090226"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090226"><span class="hs-identifier hs-var">as1</span></a></span></span><span> </span><span id="local-6989586621681090225"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090225"><span class="hs-identifier hs-var">as2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- pprTrace &quot;uAvailInfos&quot; (ppr as1 $$ ppr as2) $</span><span>
</span><span id="line-223"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681090219"><span class="annot"><span class="annottext">mkOE :: [AvailInfo] -&gt; UniqFM OccName AvailInfo
</span><a href="#local-6989586621681090219"><span class="hs-identifier hs-var hs-var">mkOE</span></a></span></span><span> </span><span id="local-6989586621681090218"><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090218"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(OccName, AvailInfo)] -&gt; UniqFM OccName AvailInfo
forall key elt. Uniquable key =&gt; [(key, elt)] -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#listToUFM"><span class="hs-identifier hs-var">listToUFM</span></a></span><span> </span><span class="annot"><span class="annottext">([(OccName, AvailInfo)] -&gt; UniqFM OccName AvailInfo)
-&gt; [(OccName, AvailInfo)] -&gt; UniqFM OccName AvailInfo
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681090216"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090216"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090218"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-224"></span><span>                                 </span><span id="local-6989586621681090215"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090215"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; [Name]
</span><a href="GHC.Types.Avail.html#availNames"><span class="hs-identifier hs-var">availNames</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090216"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-225"></span><span>                                 </span><span class="annot"><span class="annottext">(OccName, AvailInfo) -&gt; [(OccName, AvailInfo)]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090215"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090216"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-226"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">(ShNameSubst -&gt; (AvailInfo, AvailInfo) -&gt; Either SDoc ShNameSubst)
-&gt; ShNameSubst
-&gt; [(AvailInfo, AvailInfo)]
-&gt; Either SDoc ShNameSubst
forall (t :: * -&gt; *) (m :: * -&gt; *) b a.
(Foldable t, Monad m) =&gt;
(b -&gt; a -&gt; m b) -&gt; b -&gt; t a -&gt; m b
</span><a href="../../base/src/Control.Monad.html#foldM"><span class="hs-identifier hs-var">foldM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681090212"><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090212"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681090211"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090211"><span class="hs-identifier hs-var">a1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681090210"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090210"><span class="hs-identifier hs-var">a2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ModuleName
-&gt; ShNameSubst -&gt; AvailInfo -&gt; AvailInfo -&gt; Either SDoc ShNameSubst
</span><a href="GHC.Types.Name.Shape.html#uAvailInfo"><span class="hs-identifier hs-var">uAvailInfo</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090227"><span class="hs-identifier hs-var">flexi</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090212"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090211"><span class="hs-identifier hs-var">a1</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090210"><span class="hs-identifier hs-var">a2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ShNameSubst
forall a. NameEnv a
</span><a href="GHC.Types.Name.Env.html#emptyNameEnv"><span class="hs-identifier hs-var">emptyNameEnv</span></a></span><span>
</span><span id="line-227"></span><span>             </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqFM OccName (AvailInfo, AvailInfo) -&gt; [(AvailInfo, AvailInfo)]
forall key elt. UniqFM key elt -&gt; [elt]
</span><a href="GHC.Types.Unique.FM.html#eltsUFM"><span class="hs-identifier hs-var">eltsUFM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(AvailInfo -&gt; AvailInfo -&gt; (AvailInfo, AvailInfo))
-&gt; UniqFM OccName AvailInfo
-&gt; UniqFM OccName AvailInfo
-&gt; UniqFM OccName (AvailInfo, AvailInfo)
forall elt1 elt2 elt3 key.
(elt1 -&gt; elt2 -&gt; elt3)
-&gt; UniqFM key elt1 -&gt; UniqFM key elt2 -&gt; UniqFM key elt3
</span><a href="GHC.Types.Unique.FM.html#intersectUFM_C"><span class="hs-identifier hs-var">intersectUFM_C</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">,</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[AvailInfo] -&gt; UniqFM OccName AvailInfo
</span><a href="#local-6989586621681090219"><span class="hs-identifier hs-var">mkOE</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090226"><span class="hs-identifier hs-var">as1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[AvailInfo] -&gt; UniqFM OccName AvailInfo
</span><a href="#local-6989586621681090219"><span class="hs-identifier hs-var">mkOE</span></a></span><span> </span><span class="annot"><span class="annottext">[AvailInfo]
</span><a href="#local-6989586621681090225"><span class="hs-identifier hs-var">as2</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-228"></span><span>             </span><span class="hs-comment">-- Edward: I have to say, this is pretty clever.</span><span>
</span><span id="line-229"></span><span>
</span><span id="line-230"></span><span class="hs-comment">-- | Unify two 'AvailInfo's, given an existing substitution @subst@,</span><span>
</span><span id="line-231"></span><span class="hs-comment">-- with only name holes from @flexi@ unifiable (all other name holes rigid.)</span><span>
</span><span id="line-232"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#uAvailInfo"><span class="hs-identifier hs-type">uAvailInfo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html#ShNameSubst"><span class="hs-identifier hs-type">ShNameSubst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Avail.html#AvailInfo"><span class="hs-identifier hs-type">AvailInfo</span></a></span><span>
</span><span id="line-233"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html#ShNameSubst"><span class="hs-identifier hs-type">ShNameSubst</span></a></span><span>
</span><span id="line-234"></span><span id="uAvailInfo"><span class="annot"><span class="annottext">uAvailInfo :: ModuleName
-&gt; ShNameSubst -&gt; AvailInfo -&gt; AvailInfo -&gt; Either SDoc ShNameSubst
</span><a href="GHC.Types.Name.Shape.html#uAvailInfo"><span class="hs-identifier hs-var hs-var">uAvailInfo</span></a></span></span><span> </span><span id="local-6989586621681090205"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090205"><span class="hs-identifier hs-var">flexi</span></a></span></span><span> </span><span id="local-6989586621681090204"><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090204"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Avail.html#Avail"><span class="hs-identifier hs-type">Avail</span></a></span><span> </span><span id="local-6989586621681090203"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090203"><span class="hs-identifier hs-var">n1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Avail.html#Avail"><span class="hs-identifier hs-type">Avail</span></a></span><span> </span><span id="local-6989586621681090202"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090202"><span class="hs-identifier hs-var">n2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName
-&gt; ShNameSubst -&gt; Name -&gt; Name -&gt; Either SDoc ShNameSubst
</span><a href="GHC.Types.Name.Shape.html#uName"><span class="hs-identifier hs-var">uName</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090205"><span class="hs-identifier hs-var">flexi</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090204"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090203"><span class="hs-identifier hs-var">n1</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090202"><span class="hs-identifier hs-var">n2</span></a></span><span>
</span><span id="line-235"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#uAvailInfo"><span class="hs-identifier hs-var">uAvailInfo</span></a></span><span> </span><span id="local-6989586621681090200"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090200"><span class="hs-identifier hs-var">flexi</span></a></span></span><span> </span><span id="local-6989586621681090199"><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090199"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-type">AvailTC</span></a></span><span> </span><span id="local-6989586621681090198"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090198"><span class="hs-identifier hs-var">n1</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Avail.html#AvailTC"><span class="hs-identifier hs-type">AvailTC</span></a></span><span> </span><span id="local-6989586621681090197"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090197"><span class="hs-identifier hs-var">n2</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName
-&gt; ShNameSubst -&gt; Name -&gt; Name -&gt; Either SDoc ShNameSubst
</span><a href="GHC.Types.Name.Shape.html#uName"><span class="hs-identifier hs-var">uName</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090200"><span class="hs-identifier hs-var">flexi</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090199"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090198"><span class="hs-identifier hs-var">n1</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090197"><span class="hs-identifier hs-var">n2</span></a></span><span>
</span><span id="line-236"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#uAvailInfo"><span class="hs-identifier hs-var">uAvailInfo</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681090196"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090196"><span class="hs-identifier hs-var">a1</span></a></span></span><span> </span><span id="local-6989586621681090195"><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090195"><span class="hs-identifier hs-var">a2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Either SDoc ShNameSubst
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; Either SDoc ShNameSubst)
-&gt; SDoc -&gt; Either SDoc ShNameSubst
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;While merging export lists, could not combine&quot;</span></span><span>
</span><span id="line-237"></span><span>                           </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090196"><span class="hs-identifier hs-var">a1</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;with&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">AvailInfo
</span><a href="#local-6989586621681090195"><span class="hs-identifier hs-var">a2</span></a></span><span>
</span><span id="line-238"></span><span>                           </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;one is a type, the other is a plain identifier&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-239"></span><span>
</span><span id="line-240"></span><span class="hs-comment">-- | Unify two 'Name's, given an existing substitution @subst@,</span><span>
</span><span id="line-241"></span><span class="hs-comment">-- with only name holes from @flexi@ unifiable (all other name holes rigid.)</span><span>
</span><span id="line-242"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#uName"><span class="hs-identifier hs-type">uName</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html#ShNameSubst"><span class="hs-identifier hs-type">ShNameSubst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html#ShNameSubst"><span class="hs-identifier hs-type">ShNameSubst</span></a></span><span>
</span><span id="line-243"></span><span id="uName"><span class="annot"><span class="annottext">uName :: ModuleName
-&gt; ShNameSubst -&gt; Name -&gt; Name -&gt; Either SDoc ShNameSubst
</span><a href="GHC.Types.Name.Shape.html#uName"><span class="hs-identifier hs-var hs-var">uName</span></a></span></span><span> </span><span id="local-6989586621681090190"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090190"><span class="hs-identifier hs-var">flexi</span></a></span></span><span> </span><span id="local-6989586621681090189"><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090189"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span id="local-6989586621681090188"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090188"><span class="hs-identifier hs-var">n1</span></a></span></span><span> </span><span id="local-6989586621681090187"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090187"><span class="hs-identifier hs-var">n2</span></a></span></span><span>
</span><span id="line-244"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090188"><span class="hs-identifier hs-var">n1</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Name -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090187"><span class="hs-identifier hs-var">n2</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ShNameSubst -&gt; Either SDoc ShNameSubst
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090189"><span class="hs-identifier hs-var">subst</span></a></span><span>
</span><span id="line-245"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="#local-6989586621681090186"><span class="hs-identifier hs-var">isFlexi</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090188"><span class="hs-identifier hs-var">n1</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName
-&gt; ShNameSubst -&gt; Name -&gt; Name -&gt; Either SDoc ShNameSubst
</span><a href="GHC.Types.Name.Shape.html#uHoleName"><span class="hs-identifier hs-var">uHoleName</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090190"><span class="hs-identifier hs-var">flexi</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090189"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090188"><span class="hs-identifier hs-var">n1</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090187"><span class="hs-identifier hs-var">n2</span></a></span><span>
</span><span id="line-246"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="#local-6989586621681090186"><span class="hs-identifier hs-var">isFlexi</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090187"><span class="hs-identifier hs-var">n2</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName
-&gt; ShNameSubst -&gt; Name -&gt; Name -&gt; Either SDoc ShNameSubst
</span><a href="GHC.Types.Name.Shape.html#uHoleName"><span class="hs-identifier hs-var">uHoleName</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090190"><span class="hs-identifier hs-var">flexi</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090189"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090187"><span class="hs-identifier hs-var">n2</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090188"><span class="hs-identifier hs-var">n1</span></a></span><span>
</span><span id="line-247"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Either SDoc ShNameSubst
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;While merging export lists, could not unify&quot;</span></span><span>
</span><span id="line-248"></span><span>                         </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090188"><span class="hs-identifier hs-var">n1</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;with&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090187"><span class="hs-identifier hs-var">n2</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681090183"><span class="hs-identifier hs-var">extra</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-249"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-250"></span><span>    </span><span id="local-6989586621681090186"><span class="annot"><span class="annottext">isFlexi :: Name -&gt; Bool
</span><a href="#local-6989586621681090186"><span class="hs-identifier hs-var hs-var">isFlexi</span></a></span></span><span> </span><span id="local-6989586621681090179"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090179"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isHoleName"><span class="hs-identifier hs-var">isHoleName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090179"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Module -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; Module
Name -&gt; Module
</span><a href="GHC.Types.Name.html#nameModule"><span class="hs-identifier hs-var">nameModule</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090179"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; ModuleName -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090190"><span class="hs-identifier hs-var">flexi</span></a></span><span>
</span><span id="line-251"></span><span>    </span><span id="local-6989586621681090183"><span class="annot"><span class="annottext">extra :: SDoc
</span><a href="#local-6989586621681090183"><span class="hs-identifier hs-var hs-var">extra</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isHoleName"><span class="hs-identifier hs-var">isHoleName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090188"><span class="hs-identifier hs-var">n1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="GHC.Types.Name.html#isHoleName"><span class="hs-identifier hs-var">isHoleName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090187"><span class="hs-identifier hs-var">n2</span></a></span><span>
</span><span id="line-252"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Neither name variable originates from the current signature.&quot;</span></span><span>
</span><span id="line-253"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-254"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-255"></span><span>
</span><span id="line-256"></span><span class="hs-comment">-- | Unify a name @h@ which 'isHoleName' with another name, given an existing</span><span>
</span><span id="line-257"></span><span class="hs-comment">-- substitution @subst@, with only name holes from @flexi@ unifiable (all</span><span>
</span><span id="line-258"></span><span class="hs-comment">-- other name holes rigid.)</span><span>
</span><span id="line-259"></span><span class="annot"><a href="GHC.Types.Name.Shape.html#uHoleName"><span class="hs-identifier hs-type">uHoleName</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html#ShNameSubst"><span class="hs-identifier hs-type">ShNameSubst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-comment">{- hole name -}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>
</span><span id="line-260"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.Shape.html#ShNameSubst"><span class="hs-identifier hs-type">ShNameSubst</span></a></span><span>
</span><span id="line-261"></span><span id="uHoleName"><span class="annot"><span class="annottext">uHoleName :: ModuleName
-&gt; ShNameSubst -&gt; Name -&gt; Name -&gt; Either SDoc ShNameSubst
</span><a href="GHC.Types.Name.Shape.html#uHoleName"><span class="hs-identifier hs-var hs-var">uHoleName</span></a></span></span><span> </span><span id="local-6989586621681090173"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090173"><span class="hs-identifier hs-var">flexi</span></a></span></span><span> </span><span id="local-6989586621681090172"><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090172"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span id="local-6989586621681090171"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090171"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span id="local-6989586621681090170"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090170"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-262"></span><span>    </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isHoleName</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-263"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ShNameSubst -&gt; Name -&gt; Maybe Name
forall a. NameEnv a -&gt; Name -&gt; Maybe a
</span><a href="GHC.Types.Name.Env.html#lookupNameEnv"><span class="hs-identifier hs-var">lookupNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090172"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090171"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-264"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681090166"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090166"><span class="hs-identifier hs-var">n'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ModuleName
-&gt; ShNameSubst -&gt; Name -&gt; Name -&gt; Either SDoc ShNameSubst
</span><a href="GHC.Types.Name.Shape.html#uName"><span class="hs-identifier hs-var">uName</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681090173"><span class="hs-identifier hs-var">flexi</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090172"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090166"><span class="hs-identifier hs-var">n'</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090170"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-265"></span><span>                </span><span class="hs-comment">-- Do a quick check if the other name is substituted.</span><span>
</span><span id="line-266"></span><span>        </span><span class="annot"><span class="annottext">Maybe Name
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681090165"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090165"><span class="hs-identifier hs-var">n'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ShNameSubst -&gt; Name -&gt; Maybe Name
forall a. NameEnv a -&gt; Name -&gt; Maybe a
</span><a href="GHC.Types.Name.Env.html#lookupNameEnv"><span class="hs-identifier hs-var">lookupNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090172"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090170"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-267"></span><span>                    </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isHoleName</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-identifier">uName</span><span> </span><span class="hs-identifier">flexi</span><span> </span><span class="hs-identifier">subst</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-identifier">n'</span><span>
</span><span id="line-268"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-269"></span><span>                    </span><span class="annot"><span class="annottext">ShNameSubst -&gt; Either SDoc ShNameSubst
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ShNameSubst -&gt; Name -&gt; Name -&gt; ShNameSubst
forall a. NameEnv a -&gt; Name -&gt; a -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#extendNameEnv"><span class="hs-identifier hs-var">extendNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">ShNameSubst
</span><a href="#local-6989586621681090172"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090171"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681090170"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-270"></span></pre></body></html>